#!/bin/bash

# 在这里定义你的项目目录
WORK_FOLDER="/opt/wxopensvr/script/wuhan_virus_notify"
pid=$(ps aux | grep 'cron_run.py' | grep -v grep | awk '{print$2}')
if [ $pid -gt 0 ] 
then
    kill -9 $pid
    echo '已杀掉原来进程'
else
    echo '未发现原有进程'
fi

echo '重启进程'
source $WORK_FOLDER/venv/bin/activate
$WORK_FOLDER/venv/bin/python3 $WORK_FOLDER/run.py r
new_pid=$(ps aux | grep 'cron_run.py' | grep -v grep | awk '{print$2}')
echo '重启成功,new_pid:' $new_pid
